import { defineStore } from 'pinia';

type stringOrNull = string | null;
interface AppState {
  userName: stringOrNull;
  userToken: stringOrNull;
  channelId: stringOrNull;
  corpId: stringOrNull;
  rateConfig: any;
  corpConfig: any;
  workGroupConfig: any;
}

export const useAppStore = defineStore('appStore', {
  state: (): AppState => ({
    userName: '',
    userToken: '',
    channelId: '',
    corpId: '',
    //点评配置
    rateConfig: null,
    //企业配置
    corpConfig: null,
    // 工作组配置
    workGroupConfig: null
  }),
  getters: {},
  actions: {
    setUserInfo(params: any) {
      this.userName = params.userName;
      this.userToken = params.token;
      this.channelId = params.channelId;
      this.corpId = params.corpId;
    },

    setRateConfig(data: any) {
      this.rateConfig = data;
    },

    setCorpConfig(data: any) {
      this.corpConfig = data;
    },
    setWorkGroupConfig(data: any) {
      this.workGroupConfig = data;
    }
  }
});
